package com.at.bigdata.spark.core.rdd.operator.transform

import org.apache.spark.{SparkConf, SparkContext}

/**
 *
 * @author cdhuangchao3
 * @date 2023/3/19 9:52 PM
 */
object Spark12_RDD_sortBy {

  def main(args: Array[String]): Unit = {
    // 环境准备
    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("Operator")
    val sc = new SparkContext(sparkConf)

    // TODO 算子 - sortBy
    val rdd = sc.makeRDD(List(6, 2, 4, 5, 3, 1), 2)

    val newRDD = rdd.sortBy(num => num)

    newRDD.saveAsTextFile("output")

    sc.stop()
  }

}
